﻿<UserControl x:Class="ReflectionStudio.Components.UserControls.AssemblyDetail"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Controls="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"
    HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
    >
    <UserControl.Resources>
        <ResourceDictionary>
            
        <Style x:Key="TreeViewItemStyle" TargetType="TreeViewItem">
            <Setter Property="IsExpanded" Value="False" />
            <Setter Property="KeyboardNavigation.AcceptsReturn" Value="True" />
            <Setter Property="Controls:VirtualToggleButton.IsVirtualToggleButton" Value="True" />
            <Setter Property="Controls:VirtualToggleButton.IsChecked" Value="{Binding IsChecked}" />
        </Style>

            <HierarchicalDataTemplate  x:Key="CheckBoxItemTemplate" ItemsSource="{Binding Children, Mode=TwoWay}" >
                <StackPanel Orientation="Horizontal">
                    <CheckBox Focusable="False" VerticalAlignment="Center"
                        IsChecked="{Binding IsChecked}" />
                    <ContentPresenter Margin="2,0"
                        Content="{Binding DisplayName, Mode=OneWay}" />
                </StackPanel>
            </HierarchicalDataTemplate>
        </ResourceDictionary>
    </UserControl.Resources>
    
    <Grid Margin="5">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="2*" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="60" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Controls:StandaloneHeader Image="/ReflectionStudio;component/Resources/Images/32x32/assembly.png" 
            Title="{Binding ElementName=AssemblyComboBox, Path=SelectedItem.Name, StringFormat=Assembly details: \{0:S\}}" 
            Description="Assembly details display all class and function inside an assembly. Choose what to inject..." 
            Grid.ColumnSpan="2"/>
        
        <ComboBox Name="AssemblyComboBox" Grid.ColumnSpan="2" Height="22" VerticalAlignment="Top" HorizontalAlignment="Right"
                  ItemsSource="{Binding Project.Assemblies}" DisplayMemberPath="Name" IsSynchronizedWithCurrentItem="True" />
        
        <GroupBox Margin="5" Grid.Row="1"  Header="Assembly content" x:Name="groupBox1"
                  DataContext="{Binding ElementName=AssemblyComboBox, Path=SelectedItem}">
            
                <TreeView Name="treeViewAssembly" Margin="5"
                          DataContext="{Binding Path=Children}"
                          ItemContainerStyle="{StaticResource TreeViewItemStyle}"
                          ItemsSource="{Binding Mode=OneTime}"
                          ItemTemplate="{StaticResource CheckBoxItemTemplate}"/>
        </GroupBox>
        <GridSplitter Grid.Column="1" Grid.Row="1" HorizontalAlignment="Left" Width="4"></GridSplitter>
        <GroupBox Margin="5" Grid.Row="1" Grid.Column="2" Header="Details" x:Name="groupBox2"
                  DataContext="{Binding ElementName=AssemblyComboBox, Path=SelectedItem}">
            
            <StackPanel Orientation="Vertical">
               <TextBlock Text="Original values" ></TextBlock>
               <Grid Margin="5" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="110" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>
                    <StackPanel Orientation="Vertical" Grid.Column="0">
                        <TextBlock Text="Version" ></TextBlock>
                        <TextBlock Text="Size" ></TextBlock>
                        <TextBlock Text="Culture" ></TextBlock>
                        <TextBlock Text="PublicKey" ></TextBlock>
                        <TextBlock Text="PublicKeyToken" ></TextBlock>
                        <TextBlock Text="Hash" ></TextBlock>
                        <TextBlock Text="HashAlgorithm" ></TextBlock>
                        <TextBlock Text="Main module" ></TextBlock>
                        <TextBlock Text="Entry point" ></TextBlock>
                        <TextBlock Text="Target runtime" ></TextBlock>
                        <TextBlock Text="Kind" ></TextBlock>
                        <TextBlock Text="Class count" ></TextBlock>
                    </StackPanel>
                    <StackPanel Orientation="Vertical" Grid.Column="1">
                        <TextBlock Text="{Binding Version, Mode=OneTime}" TextWrapping="Wrap"></TextBlock>
                        <TextBlock Text="{Binding Size, Mode=OneTime}" ></TextBlock>
                        <TextBlock Text="{Binding Culture, Mode=OneTime}" ></TextBlock>
                        <TextBlock Text="{Binding PublicKey, Mode=OneTime}" ></TextBlock>
                        <TextBlock Text="{Binding PublicKeyToken, Mode=OneTime}" ></TextBlock>
                        <TextBlock Text="{Binding Hash, Mode=OneTime}"  TextWrapping="Wrap"></TextBlock>
                        <TextBlock Text="{Binding HashAlgorithm, Mode=OneTime}"  TextWrapping="Wrap"></TextBlock>
                        <TextBlock Text="{Binding Name, Mode=OneTime}" ></TextBlock>
                        <TextBlock Text="{Binding EntryPoint, Mode=OneTime}" ></TextBlock>
                        <TextBlock Text="{Binding TargetRuntime, Mode=OneTime}" ></TextBlock>
                        <TextBlock Text="{Binding Kind, Mode=OneTime}" ></TextBlock>
                        <TextBlock Text="{Binding Children.Count, Mode=OneTime}" ></TextBlock>
                    </StackPanel>
                </Grid>
                <TextBlock Text="Build values" ></TextBlock>
                <Grid Margin="5" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="70" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>
                    <StackPanel Orientation="Vertical" Grid.Column="0">
                        <TextBlock Text="Size" ></TextBlock>
                        <TextBlock Text="Profiled class" ></TextBlock>
                    </StackPanel>
                    <StackPanel Orientation="Vertical" Grid.Column="1">
                        <TextBlock Text="{Binding Size, Mode=OneTime}" ></TextBlock>
                        <TextBlock Text="{Binding Children.Count, Mode=OneTime}" ></TextBlock>
                    </StackPanel>
                </Grid>
            </StackPanel>
        </GroupBox>
    </Grid>
</UserControl>
